import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import postcssPxToViewport from 'postcss-px-to-viewport-8-plugin'
// https://vite.dev/config/
export default defineConfig({
  plugins: [react()],
   server: {
    proxy: {
      // 选项写法
      '/api': {
        target: 'http://113.44.139.133:8005',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      },
      '/tx': {
        target: ' http://124.221.74.149:3000/',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/tx/, '')
      },
    }
   },
   css: {
    postcss: {
      plugins: [
      postcssPxToViewport({
  unitToConvert: 'px',
  viewportWidth: 375,
  unitPrecision: 5,
  propList: ['*'],
  viewportUnit: 'vw',
  fontViewportUnit: 'vw',
  selectorBlackList: [],
  minPixelValue: 1,
  mediaQuery: false,
  replace: true,
  exclude: [],
  landscape: false,
  landscapeUnit: 'vw',
  landscapeWidth: 568
})
      ],
    },
  },
})
